package command.project.workspace;

import javax.xml.bind.annotation.XmlTransient;

import model.Workspace;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import controller.ApplicationController;

public class OpenWorkspaceCommand extends AbstractWorkspaceCommand {

	private String userName;

	@XmlTransient
	private static final Logger log = LoggerFactory
			.getLogger(OpenWorkspaceCommand.class);

	public OpenWorkspaceCommand(String userName) {
		this.userName = userName;
	}

	@Override
	public void executeLocal(ApplicationController applicationController) {
		log.debug("Executing command : OpenWorkspaceCommand ...");
		Workspace workspace = applicationController.getModel()
				.getCurrentProject().getWorkspace(userName);
		if (workspace != null) {
			applicationController.getModel().getCurrentProject()
					.openWorkspace(workspace);
		}
		log.debug("Executing command : OpenWorkspaceCommand DONE");
	}

	@Override
	public void executeRemote(ApplicationController applicationController) {
	}

}
